package com.hangxintong.common.base.entity;

import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface UserRepository extends BaseJpaRepository<LmUser> {

    LmUser findByMobile(String mobile);

    LmUser findByMobileAndIdNot(String mobile, Long id);

    int countByMobile(String phone);
    @Query(value = "select username,mobile from lm_user where id in(?1)",nativeQuery = true)
    List<Map<String,String>> findByIdIn(List<Long> ids);

    LmUser findByOpenId(String openId);

    @Query(value = "select id from lm_user WHERE realname LIKE concat ('%',?1,'%')", nativeQuery = true)
    List<Long> findByLikeUsername(String search);
}
